﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Scheduling.Models.Interfaces;

namespace Scheduling.Models.Repos.InMemory
{
    public class InMemoryBookingRequestLoader : IBookingRequestLoader
    {
        public List<BookingRequest> GetBookingRequests()
        {
            var courseInstanceLoader = IoC.Resolve<ICourseInstanceLoader>();
            var userLoader = IoC.Resolve<IUserLoader>();
            var courseInstances = courseInstanceLoader.GetCourseInstances();
            var users = userLoader.GetUsers();
            var requestList = new List<BookingRequest>()
            {
                new BookingRequest() { ID = 1, StartPeriod = 1, Year = 2011, LectureCount = 20, Priority = Priority.Time, RoomType = RoomType.LectureHall, 
                                       RequiredCapacity = 30, RoomPattern = "21E404", Time = 8, 

                                       CourseInstance = courseInstances.First(),
                                       Booker = users.First(),
                                       AllowedDays = new Dictionary<DayOfWeek,DayType>()
                                       {
                                           { DayOfWeek.Monday, DayType.Every }, 
                                           { DayOfWeek.Tuesday, DayType.Every }, 
                                           { DayOfWeek.Wednesday, DayType.Even }, 
                                       }
                },

                new BookingRequest() { ID = 2, StartPeriod = 1, Year = 2011, LectureCount = 20, Priority = Priority.Room, RoomType = RoomType.LectureHall, 
                                       RequiredCapacity = 30, RoomPattern = "21E404", Time = 8, 

                                       CourseInstance = courseInstances.Last(),
                                       Booker = users.Last(),
                                       AllowedDays = new Dictionary<DayOfWeek,DayType>()
                                       {
                                           { DayOfWeek.Monday, DayType.Every }, 
                                           { DayOfWeek.Tuesday, DayType.Every }, 
                                           { DayOfWeek.Wednesday, DayType.Even }, 
                                       }
                }
            };

            return requestList;
        }

        public BookingRequest GetBookingRequest(int id)
        {
            throw new NotImplementedException();
        }

        public List<BookingRequest> GetBookingRequestsByUserId(string userID)
        {
            throw new NotImplementedException();
        }

        public void InsertBookingRequest(BookingRequest request)
        {
            throw new NotImplementedException();
        }

        public int GetHighestRequestID()
        {
            throw new NotImplementedException();
        }


        public void DeleteRequest(int ID)
        {
            throw new NotImplementedException();
        }

    }
}